package com.larry.rabbitmq.second;

import com.larry.rabbitmq.util.RabbitMQUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Delivery;

/**
 * @author larry
 * @Title: larry-rabbitmq
 * @Package com.larry.rabbitmq.second
 * @Description: 工作线程(消费者)
 * @date 6/28/216:35 PM
 */
public class Work01 {
    public static final String QUEUE_NAME = "hello";

    public static void main(String args[]) throws Exception{
        Channel channel = RabbitMQUtils.getChannel();

        System.out.println("c1等待接收...........");

        //消息接收
        channel.basicConsume(QUEUE_NAME,true,(consumerTag, message) -> {
            System.out.println("work01接收到: " + new String(message.getBody()));
        },consumerTag -> {
            System.out.println("中断.....");
        });
    }
}
